# Group Custom Forms
Custom Forms related to the events.

| Parameter | Description | Type | Required |
|:----------|-------------|------|----------|
| `form`  | Custom Form | string | **yes** |
| `field-identifier` | Identifier for the custom form field | string | **yes** |
| `type` | Custom Form type, allowed: "text", "checkbox", "select", "file", "image", "email" | string | **yes** |
| `is-required` | If the custom form is required | boolean | - |
| `is-included` | If the custom form is included | boolean | - |
| `is-fixed` | If the custom form is fixed | boolean | - |
| `tickets-number` | Tickets Number for custom form | integer (>=0) | - |



## Custom Form Collection [/v1/custom-forms{?page%5bsize%5d,page%5bnumber%5d,sort,filter}]
+ Parameters
    + page%5bsize%5d (optional, integer, `10`) - Maximum number of resources in a single paginated response.
    + page%5bnumber%5d (optional, integer, `1`) - Page number to fetched for the paginated response.
    + sort (optional, string, `type`) - Sort the resources according to the given attribute in ascending order. Append '-' to sort in descending order.
    + filter (optional, string, `[]`) - Filter according to the flask-rest-jsonapi filtering system. Please refer: http://flask-rest-jsonapi.readthedocs.io/en/latest/iltering.html for more.

### Create Custom Form [POST]
Create a new Custom Form with event_id.

+ Request (application/vnd.api+json)

    + Headers

            Authorization: JWT <Auth Key>

    + Body

            {
              "data": {
                "type": "custom-form",
                "relationships": {
                      "event": {
                        "data": {
                          "type": "event",
                          "id": "1"
                        }
                      }
                    },
                "attributes": {
                      "form": "speaker",
                      "type": "text",
                      "field-identifier": "name",
                      "is-required": "true",
                      "is-included": "false",
                      "is-fixed": "false"
                    }
                }
            }


+ Response 201 (application/vnd.api+json)

        {
            "data": {
                "relationships": {
                    "event": {
                        "links": {
                            "self": "/v1/custom-forms/1/relationships/event",
                            "related": "/v1/custom-forms/1/event"
                        }
                    }
                },
                "attributes": {
                    "is-required": true,
                    "form": "speaker",
                    "field-identifier": "name",
                    "is-included": false,
                    "is-fixed": false,
                    "type": "text"
                },
                "type": "custom-form",
                "id": 1,
                "links": {
                    "self": "/v1/custom-forms/1"
                }
            },
            "jsonapi": {
                "version": "1.0"
            },
            "links": {
                "self": "/v1/custom-forms/1"
            }
        }


## Custom Form Detail [/v1/custom-forms/{custom_form_id}]
+ Parameters
    + custom_form_id: 1 (integer) - ID of the custom form in the form of an integer

### Custom Form Detail [GET]
Get a single custom form.

+ Request

    + Headers

            Accept: application/vnd.api+json

            Authorization: JWT <Auth Key>

+ Response 200 (application/vnd.api+json)

        {
            "data": {
                "relationships": {
                    "event": {
                        "links": {
                            "self": "/v1/custom-forms/1/relationships/event",
                            "related": "/v1/custom-forms/1/event"
                        }
                    }
                },
                "attributes": {
                    "is-required": true,
                    "form": "speaker",
                    "field-identifier": "name",
                    "is-fixed": false,
                    "is-included": false,
                    "type": "text"
                },
                "type": "custom-form",
                "id": 1,
                "links": {
                    "self": "/v1/custom-forms/1"
                }
            },
            "jsonapi": {
                "version": "1.0"
            },
            "links": {
                "self": "/v1/custom-forms/1"
            }
        }


### Update Custom Form [PATCH]
Update a single custom form with `id`.

+ `id` (integer) - ID of the record to update **(required)**

+ Request (application/vnd.api+json)

    + Headers

            Authorization: JWT <Auth Key>

    + Body

            {
              "data": {
                "type": "custom-form",
                "attributes": {
                    "form": "speaker",
                    "field-identifier": "name",
                    "type": "text",
                    "is-required": "false",
                    "is-included": "false",
                    "is-fixed": "false"
                },
                "id": "1"
              }
            }


+ Response 200 (application/vnd.api+json)

        {
            "data": {
                "relationships": {
                    "event": {
                        "links": {
                            "self": "/v1/custom-forms/1/relationships/event",
                            "related": "/v1/custom-forms/1/event"
                        }
                    }
                },
                "attributes": {
                    "is-required": false,
                    "form": "speaker",
                    "field-identifier": "name",
                    "is-fixed": false,
                    "is-included": false,
                    "type": "text"
                },
                "type": "custom-form",
                "id": 1,
                "links": {
                    "self": "/v1/custom-forms/1"
                }
            },
            "jsonapi": {
                "version": "1.0"
            },
            "links": {
                "self": "/v1/custom-forms/1"
            }
        }

### Delete Custom Form [DELETE]
Delete a single Access code.

+ Request

    + Headers

            Accept: application/vnd.api+json

            Authorization: JWT <Auth Key>

+ Response 200 (application/vnd.api+json)

        {
          "meta": {
            "message": "Object successfully deleted"
          },
          "jsonapi": {
            "version": "1.0"
          }
        }


## Event Custom Form Collection [/v1/events/{event_identifier}/custom-forms{?page%5bsize%5d,page%5bnumber%5d,sort,filter}]
+ Parameters
    + event_identifier: 1 (string) - identifier or event id of the event. (b8324ae2 is an example of identifier)
    + page%5bsize%5d (optional, integer, `10`) - Maximum number of resources in a single paginated response.
    + page%5bnumber%5d (optional, integer, `1`) - Page number to fetched for the paginated response.
    + sort (optional, string, `type`) - Sort the resources according to the given attribute in ascending order. Append '-' to sort in descending order.
    + filter (optional, string, `[]`) - Filter according to the flask-rest-jsonapi filtering system. Please refer: http://flask-rest-jsonapi.readthedocs.io/en/latest/iltering.html for more.

### List All Custom Forms for an Event [GET]
Get a list of Custom Forms for an event.

+ Request

    + Headers

            Accept: application/vnd.api+json

            Authorization: JWT <Auth Key>


+ Response 200 (application/vnd.api+json)


        {
            "meta": {
                "count": 1
            },
            "data": [
                {
                    "relationships": {
                        "event": {
                            "links": {
                                "self": "/v1/custom-forms/1/relationships/event",
                                "related": "/v1/custom-forms/1/event"
                            }
                        }
                    },
                    "attributes": {
                        "is-required": true,
                        "form": "speaker",
                        "field-identifier": "name",
                        "is-included": false,
                        "is-fixed": false,
                        "type": "text"
                    },
                    "type": "custom-form",
                    "id": 1,
                    "links": {
                        "self": "/v1/custom-forms/1"
                    }
                }
            ],
            "jsonapi": {
                "version": "1.0"
            },
            "links": {
                "self": "/v1/events/1/custom-forms"
            }
        }
